package com.example.nbb.Controller;

import com.example.nbb.Service.ProductService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@CrossOrigin//跨域
@RestController//遵循RestFul
@RequestMapping("/nbb/Product/")
public class ProductController {
    @Resource
    ProductService productService;

    //获取所有商品
    @GetMapping("getAllProduct")
    public String getAllProduct(@RequestParam("sort") String sort) {
        return productService.getAllProduct(sort);
    }

    @GetMapping("getAllProductDetail")
    public String getAllProduct(@RequestParam("productId") int productId) {
        return productService.getAllProduct(productId);
    }
}
